Foxit PDF SDK
FoxitPDFSDKPython3.VectorGraphics Class Reference

Class for inserting vector graphics(SVG, WMF/EMF) into PDF files. More...

Inheritance diagram for FoxitPDFSDKPython3.VectorGraphics:
FoxitPDFSDKPython3.Base

Static Public Member Functions

def Initialize (library_path)
 Initialize the vector graphics module by loading the fxvectorgraphics shared library. More...
 
def InsertSVGToPage (pdf_path, svg_path, out_pdf_path, page_index, x, y, width, height, dpi)
 Insert an SVG file into a rectangular area on an existing PDF page. More...
 
def InsertSVGToPDF (pdf_path, svg_path, out_pdf_path, page_index, page_width_pt, page_height_pt, dpi)
 Insert an SVG file as a new page into PDF document. More...
 
def InsertWMFToPage (pdf_path, wmf_path, out_pdf_path, page_index, x, y, width, height, dpi)
 Insert a WMF/EMF file into a rectangular area on an existing PDF page. More...
 
def InsertWMFToPDF (pdf_path, wmf_path, out_pdf_path, page_index, page_width_pt, page_height_pt, dpi)
 Insert a WMF/EMF file as a new page into PDF document. More...
 
def Release ()
 Release all resources allocated by the vector graphics module. More...
 

Detailed Description

Class for inserting vector graphics(SVG, WMF/EMF) into PDF files.

This class provides methods for inserting SVG vector graphics and WMF/EMF metafiles into PDF document. The target PDF is opened, modified, and saved entirely within the fxvectorgraphics shared library, so the caller never needs to open the document with Foxit PDF SDK itself. The output file preserves the structural characteristics of the input PDF (linearization, cross-reference stream, etc.) automatically.

Before calling any other method in this class, call FoxitPDFSDKPython3.VectorGraphics.Initialize to load the fxvectorgraphics shared library. Call FoxitPDFSDKPython3.VectorGraphics.Release when the module is no longer needed.

Currently, this feature is not supported on the Linux x86/ARM and Mac ARM platform.

Member Function Documentation

◆ Initialize()

FoxitPDFSDKPython3.VectorGraphics.Initialize (   library_path)
static

Initialize the vector graphics module by loading the fxvectorgraphics shared library.

During the life-cycle of the "vector graphics" module, this function should be called once before any other function in this class. The library remains loaded until FoxitPDFSDKPython3.VectorGraphics.Release is called.

Parameters
[in]library_pathFull path to the fxsvgwmf2pdf shared library file. This should not be an empty string.
Returns
None.
Note
If module "Conversion" is not defined in the license information which is used in function FoxitPDFSDKPython3.Library.Initialize , that means user has no right in using vecotr graphics related functions and this function will throw exception FoxitPDFSDKPython3.e_ErrNoConversionModuleRight .

◆ InsertSVGToPage()

FoxitPDFSDKPython3.VectorGraphics.InsertSVGToPage (   pdf_path,
  svg_path,
  out_pdf_path,
  page_index,
  x,
  y,
  width,
  height,
  dpi 
)
static

Insert an SVG file into a rectangular area on an existing PDF page.

The SVG graphic is rendered into the specified rectangle on the given page of the source PDF. The result is written to out_pdf_path. The structural characteristics of the source PDF (linearization, XRef stream, etc.) are preserved automatically.

Parameters
[in]pdf_pathPath of the source PDF file. This should not be an empty string.
[in]svg_pathPath of the SVG file. This should not be an empty string.
[in]out_pdf_pathPath of the output PDF file. This should not be an empty string.
[in]page_indexZero-based index of the page to insert the SVG into. Valid range: from 0 to (page_count-1). page_count is returned by function FoxitPDFSDKPython3.PDFDoc.GetPageCount .
[in]xX coordinate of the left edge of the target rectangle, in points.
[in]yY coordinate of the bottom edge of the target rectangle, in points.
[in]widthWidth of the target rectangle, in points. Must be greater than 0.
[in]heightHeight of the target rectangle, in points. Must be greater than 0.
[in]dpiRendering resolution in dots per inch. Must be greater than 0.
Returns
None.

◆ InsertSVGToPDF()

FoxitPDFSDKPython3.VectorGraphics.InsertSVGToPDF (   pdf_path,
  svg_path,
  out_pdf_path,
  page_index,
  page_width_pt,
  page_height_pt,
  dpi 
)
static

Insert an SVG file as a new page into PDF document.

A new page of the specified size is inserted at page_index and the SVG graphic is rendered onto it. The result is written to out_pdf_path.

Parameters
[in]pdf_pathPath of the source PDF file. If this is an empty string or the specified file does not exist, a new PDF document will be created using out_pdf_path.
[in]svg_pathPath of the SVG file. This should not be an empty string.
[in]out_pdf_pathPath of the output PDF file. This should not be an empty string.
[in]page_indexZero-based index of the page to insert the SVG into. If this value is less than 0, the page is inserted at the beginning of the document. If it is greater than or equal to page_count, the page is appended to the end of the document. page_count is returned by function FoxitPDFSDKPython3.PDFDoc.GetPageCount .
[in]page_width_ptWidth of the new page, in points. Must be greater than 0.
[in]page_height_ptHeight of the new page, in points. Must be greater than 0.
[in]dpiRendering resolution in dots per inch. Must be greater than 0.
Returns
None.

◆ InsertWMFToPage()

FoxitPDFSDKPython3.VectorGraphics.InsertWMFToPage (   pdf_path,
  wmf_path,
  out_pdf_path,
  page_index,
  x,
  y,
  width,
  height,
  dpi 
)
static

Insert a WMF/EMF file into a rectangular area on an existing PDF page.

The WMF/EMF graphic is rendered into the specified rectangle on the given page of the source PDF. The result is written to out_pdf_path. The structural characteristics of the source PDF are preserved automatically.

Parameters
[in]pdf_pathPath of the source PDF file. This should not be an empty string.
[in]wmf_pathPath of the WMF/EMF file. This should not be an empty string.
[in]out_pdf_pathPath of the output PDF file. This should not be an empty string.
[in]page_indexZero-based index of the page to insert the WMF/EMF into. Valid range: from 0 to (page_count-1). page_count is returned by function FoxitPDFSDKPython3.PDFDoc.GetPageCount .
[in]xX coordinate of the left edge of the target rectangle, in points.
[in]yY coordinate of the bottom edge of the target rectangle, in points.
[in]widthWidth of the target rectangle, in points. Must be greater than 0.
[in]heightHeight of the target rectangle, in points. Must be greater than 0.
[in]dpiRendering resolution in dots per inch. Must be greater than 0.
Returns
None.

◆ InsertWMFToPDF()

FoxitPDFSDKPython3.VectorGraphics.InsertWMFToPDF (   pdf_path,
  wmf_path,
  out_pdf_path,
  page_index,
  page_width_pt,
  page_height_pt,
  dpi 
)
static

Insert a WMF/EMF file as a new page into PDF document.

A new page of the specified size is inserted at page_index and the WMF/EMF graphic is rendered onto it. The result is written to out_pdf_path.

Parameters
[in]pdf_pathPath of the source PDF file. If this is an empty string or the specified file does not exist, a new PDF document will be created using out_pdf_path.
[in]wmf_pathPath of the WMF/EMF file. This should not be an empty string.
[in]out_pdf_pathPath of the output PDF file. This should not be an empty string.
[in]page_indexZero-based index of the page to insert the SVG into. If this value is less than 0, the page is inserted at the beginning of the document. If it is greater than or equal to page_count, the page is appended to the end of the document. page_count is returned by function FoxitPDFSDKPython3.PDFDoc.GetPageCount .
[in]page_width_ptWidth of the new page, in points. Must be greater than 0.
[in]page_height_ptHeight of the new page, in points. Must be greater than 0.
[in]dpiRendering resolution in dots per inch. Must be greater than 0.
Returns
None.

◆ Release()

FoxitPDFSDKPython3.VectorGraphics.Release ( )
static

Release all resources allocated by the vector graphics module.

When the user no longer needs the "vector graphics" module, this function should be called to unload the shared library and release all associated resources.

Returns
None.